package com.pdg.mcplugin.payd2mine;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.bukkit.Material;

import com.pdg.mcplugin.common.baseclasses.PluginClientBase;

public class MaterialTable extends PluginClientBase<Payd2Mine> {
	
	private Map<Material,Double> table = null;
	
	private Map<Material,Double> getTable(){
		if(table==null){
			table = getPlugin().getConfigurationManager().getMaterialTable();
		}
		return table;
	}

	public MaterialTable(Payd2Mine thePlugin) {
		super(thePlugin);
	}
	
	public double getAmount(Material theMaterial){
		if(getTable().containsKey(theMaterial)){
			return getTable().get(theMaterial);
		}else{
			return getPlugin().getConfigurationManager().getDefaultAmount();
		}
	}
	
	public List<Material> getKeys(){
		List<Material> theKeys = new ArrayList<Material>();
		for(Material theMaterial : getTable().keySet()){
			theKeys.add(theMaterial);
		}
		return theKeys;
	}
}
